package com.jiaok.controller;

import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @Author jiaok
 * @Date 2023/5/4 15:19
 */
@RestController
@RequestMapping("/authority")
public class GetAuthorityController {

    @GetMapping("/getUser")
    public Principal principal(){
      return    SecurityContextHolder.getContext().getAuthentication();
    }

}
